package aad.storyboard.model;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.ColorMatrix;

public class BlueFader implements Fader{

Bitmap fadeBitmap;
	
	public BlueFader(Bitmap btm)
	{
		fadeBitmap = btm;   	
	}
	
	@Override
	public void fade(ColorMatrix cm, int contrast) {
		fadeBitmap.eraseColor(Color.BLUE); 
		setAlpha(cm, contrast);
		
	}
	
	private static void setAlpha(ColorMatrix cm, int contrast) {
		 float scale = contrast - 1.f; 
       	 cm.set(new float[] {
                0, 0, 0, 0, 0, 
                0, 0, 0, 0, 0,
                0, 0, 0, 255, 0, 
                0, 0, 0, 0, scale});
  }

}
